package com.yifeng.repo.micro.service.client.configure;

import feign.Logger;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Created by daibing on 2022/8/6.
 */
@Data
@ConfigurationProperties(prefix = "yfcloud.micro.service.client")
public class MicroServiceClientProperties {

    private boolean enabled;

    /**
     * 打印请求日志
     * 1. NONE: 不记录任何信息
     * 2. BASIE: 仅记录请求方法，URL以及响应状态码和执行时间
     * 3. HEADERS: 在BASIC的基础上，额外记录了请求和响应的头信息
     * 4. FULL：记录所有请求和响应的明细，包括头信息、请求体、元数据。
     */
    private String feignLogLevel = Logger.Level.BASIC.name();

    /**
     * Request.Options 设置请求超时时间
     */
    private long connectTimeout = 2000;
    private long readTimeout = 60 * 1000;

    /**
     * Retryer 设置请求重试
     */
    private boolean retry = false;
    private int retryMaxAttempts = 3;
    private long retryPeriod = 100;
    private long retryMaxPeriod = 1000;

    /**
     * httpclient [todo...]
     */
    private boolean enableHttpClient;
    private int maxConnections = 200;
    private int maxConnectionsPerRoute = 50;

}
